package net.zoneland.knowledge.dao;

import net.zoneland.knowledge.model.PilotPreach;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.type.JdbcType;

import java.util.List;

@Mapper
public interface PilotPreachMapper {

    /**
     * 获取领航宣讲前五条数据.
     * @param pilotPreach 领航宣讲实体类.
     * @return 结果集
     */
    @Select({"SELECT ID, TITLE, DATE_TIME, VIDEO_LINK_ADDRESS, LIVE_CONTENT FROM AITK_PILOT_PREACH WHERE ROWNUM <= 5 ORDER BY DATE_TIME DESC"})
    @Results({
            @Result(column="ID", property="id", jdbcType= JdbcType.VARCHAR),
            @Result(column="TITLE", property="title", jdbcType= JdbcType.VARCHAR),
            @Result(column="DATE_TIME", property="dateTime", jdbcType=JdbcType.TIMESTAMP),
            @Result(column="VIDEO_LINK_ADDRESS", property="videoLinkAddress", jdbcType=JdbcType.VARCHAR),
            @Result(column="LIVE_CONTENT", property="liveContent", jdbcType=JdbcType.VARCHAR),
    })
    List<PilotPreach> getPilotPreach(final PilotPreach pilotPreach);
}
